﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpGuiMainFrameInterface.h"
#include "GbmpTypeDefs.h"
#include "IApplicationWindow.h"
#include "GcmpApiDeclaration.h"

namespace gcmp
{
    /// \brief 应用程序样式主题
enum class WindowStyleTheme : int32_t
{
    Office2007Blue,
    Office2007Black,
    Office2007Silver,
    Office2007Aqua,
    Windows7Scenic,
    Office2010Silver,
    Office2010Blue,
    Office2010Black,
    Office2013White,
    Office2013Gray,
    Office2013Dark,
    Office2016Colorful,
    Office2016White,
    Office2016DarkGray,
    Office2016Black
};

class IRibbon;
class IStatusBar;
class IDockManager;
class IUiDocumentViewManager;
class IApplicationWindowEvent;
class IControlDefinitionLibrary;
class IPlatformUiRefreshedEvent;
class IUiView;
class ElementId;

/// \brief 主窗口
FINAL_INTERFACE class GCMP_GUI_MAIN_FRAME_INTERFACE_EXPORT IMainWindow  : public IApplicationWindow
{
public:
    /// \brief 析构函数
    virtual ~IMainWindow();

    /// \brief 获取控件数据定义库
    ///
    /// \return 控件数据定义库指针
    /// \see IControlDefinitionLibrary
    virtual IControlDefinitionLibrary* GetControlDefinitionLibrary() const = 0;

    /// \brief 获取Ribbon工具条
    ///
    /// \return Ribbon指针
    /// \see IRibbon
    virtual IRibbon* GetRibbon() const = 0;

    /// \brief 获取状态栏
    ///
    /// \return 状态栏指针
    /// \see IStatusBar
    virtual IStatusBar* GetStatusBar() const = 0;


    /// \brief 获取主窗口事件
    ///
    /// \return 主窗口事件指针
    /// \see IMainWindowEvent
    virtual IApplicationWindowEvent* GetMainWindowEvent() const = 0;

    /// \brief 全屏显示
    virtual void ShowFullScreen() = 0;
    
    /// \brief 正常显示
    virtual void ShowNormal() = 0;

    /// \brief 更新Ribbon和状态栏上控件的状态
    virtual void UpdateControlStatus() = 0;

    /// \brief 平铺窗口
    virtual void TileSubWindows() = 0;

    /// \brief 层叠窗口
    virtual void CascadeSubWindows() = 0;

    /// \brief 获取主窗口标题
    ///
    /// \return 主窗口标题
    virtual std::wstring GetWindowTitle() const = 0;

    /// \brief 设置主窗口标题
    ///
    /// \param title 主窗口标题
    /// \return 始终返回true
    virtual bool SetWindowTitle(const std::wstring& title) = 0;

    /// \brief 设置窗口样式主题
    /// \param styleTheme   窗口样式主题
    /// \return  设置成功返回true,否则返回false
    virtual bool SetWindowStyleTheme(WindowStyleTheme styleTheme) = 0;

    /// \brief  禁用UiView
    /// \param  vecUiViews 需要设置的UiView指针容器
    /// \param  bDisable 禁用为true，取消禁用为false
    virtual void SetUiViewDisabled(const std::vector<IUiView*>& vecUiViews, bool bDisable) = 0;

    /// \brief 获取MDI区域窗口Id
    ///
    /// \return MDI区域窗口Id
    virtual UInt64 GetMdiAreaId() const = 0;


    /// \brief 创建或打开Ui视图
    /// 同时该接口会把返回的IUiView，设置为当前窗口并最大化
    /// 注意：请勿在Action中调用该方法！ 若需要在Action中创建视图，请使用gcmp::ActionBase::PostRequest()！！
    /// \param uiDocId Ui文档的id
    /// \param modelViewId 模型视图的id
    /// \param isModelViewShared Ui视图是否共享ModelView，true共享，false不共享
    /// \return 创建的Ui视图指针
    GCMP_OBSOLETE_API(2020/12/01, IMainWindow::CreateOrOpenUiView(int uiDocId, const ElementId& modelViewId, bool isModelViewShared, const std::wstring& uiViewTag)) virtual IUiView* CreateOrOpenUiView(int uiDocId, const ElementId& modelViewId, bool isModelViewShared) = 0;

    /// \brief 创建或打开Ui视图
    /// 同时该接口会把返回的IUiView，设置为当前窗口并最大化
    /// 注意：请勿在Action中调用该方法！ 若需要在Action中创建视图，请使用gcmp::ActionBase::PostRequest()！！
    /// \param uiDocId Ui文档的id
    /// \param modelViewId 模型视图的id
    /// \param isModelViewShared Ui视图是否共享ModelView，true共享，false不共享
    /// \param uiViewTag Ui视图标识符，默认输入空字符串即可，
    ///                 只有当UiView和另外一个UiView的Document名字、ModelView类型、ModelView名字完全相同时，才需要为UiView设置一个唯一的标识符用于区分，
    ///                 此时若不唯一将会报错并且创建失败
    /// \return 创建的Ui视图指针
    virtual IUiView* CreateOrOpenUiView(int uiDocId, const ElementId& modelViewId, bool isModelViewShared, const std::wstring& uiViewTag) = 0;

    /// \brief 获取应用程序主窗口
    ///  注意：GetMainWindow获取主窗口必须在Create()之后有效，否则返回nullptr   
    /// \return 主窗口指针
    /// \see IMainWindow
    static IMainWindow* GetMainWindow();

    /// \brief  创建程序主窗口
    /// 注意：创建程序窗口应该在Application生命周期内创建，这里创建Gcmp默认Ribbon风格主窗口
    ///       另外一种方式是直接创建用户自定义的主程序窗口，该窗口符合IApplicationWindow接口要求，
    ///       可以在Application启动后立即通过IUiManager接口SetApplicationWindow设置给Gcmp,
    ///       对于自定义的主程序窗口，其行为完全有产品自己定义。
    /// \return 返回程序窗口对象
    static OwnerPtr<IApplicationWindow> Create();
};

}   // end namespace gcmp

